package org.hxzon.cyclone.fgen;

import org.hxzon.cyclone.RigidBody;
import org.hxzon.cyclone.Vector3;
//fgen.h,fgen.cpp
//重力

public class Gravity implements ForceGenerator {
    private Vector3 gravity;//重力加速度

    public Gravity(Vector3 gravity) {
        this.gravity = gravity;
    }

    public void updateForce(RigidBody body, double duration) {
        if (!body.hasFiniteMass()) {
            return;
        }

        body.addForce(gravity.multi(body.getMass()));
    }
}
